package com.xiaodou.mjf.web.xface.common;

import com.xiaodou.mjf.infrastructure.common.context.SpringContextHolder;
import com.xiaodou.mjf.infrastructure.common.utils.PropertiesLoader;

import java.util.Properties;

/**
 * Created by Rocky on 2/26/15.
 */
public class API {

    private static Properties props = null;

    static {
        String[] profiles = SpringContextHolder.getApplicationContext().getEnvironment().getDefaultProfiles();
        if(profiles != null && profiles.length > 0){
            String fileName = String.format("api.%s.properties",profiles[0]);
            props = new PropertiesLoader(fileName).getProperties();
        }else{
            props = new PropertiesLoader("api.properties").getProperties();
        }
    }

    public static String getImageServer(){
        return props.getProperty("image.server");
    }

    public static String getHost(){
        return props.getProperty("host");
    }

    public static String getReturnUrl(){
        return props.getProperty("return_url");
    }

    public static String getIbpReturnUrl(){
        return props.getProperty("ibp.return_url");
    }

    public static String getNotifyUrl(){
        return props.getProperty("notify_url");
    }

    public static String getIbpNotifyUrl(){
        return props.getProperty("ibp.notify_url");
    }


}
